package com.runa.persistence.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 2024/12/18 13:36
 * zhangYB
 */
public class PatternUtil {


    public static boolean match(String s, String regex) {
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(s);
        boolean b = matcher.find();
        if (b) {
            String group = matcher.group();
            System.out.println(group);
        }
        return b;
    }

    public static void main(String[] args) {
        String s = "HME50796";
        System.out.println(match(s, "^[0-9]"));
        System.out.println(match(s, "^[HBS]ME"));
    }



}
